<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%><%@ 
include file="/WEB-INF/jspf/import.jspf" %><%--
--%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
        <title> 车友帖 </title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <meta name="author" content="lijun_gz none" />
        <link rel="stylesheet" type="text/css" href="http://js.3conline.com/wap/pcauto/2014/touch/cyh.css">
    </head>
    <body class="g-doc">
       <!--栏目计数器/文章计数器-->
         <jsp:include page="/template/wap/common/counter.jspf">
            <jsp:param name="channel" value="7387" />
        </jsp:include>
        <div class="body">
             <%@include file="../common/intf6007.html" %>
            <!-- 公共头部 -->
            <div class="g-hd">
                <a href="http://m.pcauto.com.cn" class="header-home" title="太平洋汽车网"></a>
                <div class="header-title" style="width: 50%;">
                    <span class="header-title-nav">
                        <a href="${WAPROOT}/">车友会</a>&nbsp;&gt;&nbsp;
                        <a href="${WAPROOT}/${myUrl}/">${fn:length(fn:escapeXml(club.name))>8?fn:substring(fn:escapeXml(club.name),0,8):fn:escapeXml(club.name)}${fn:length(fn:escapeXml(club.name))>8?"...":""}</a>  > 车友帖
                    </span>
                </div>
            </div>
            <div class="m-none" id="JLAST_VIEW_NONE" style="display: block;">
                <span> &gt;_&lt; lll</span>
                <p>该车友会还没车友发过帖子哦~</p>
            </div>
            <ul class="m-tlist" id="topic-list"></ul>
            <div class="btn-more">
                <a class="addmore" id="addMore" onclick="loadComment();" >
                    <span class="s1" id="showMore">点击查看更多</span>
                    <span class="s2" id="loadMoreNow" style="display:none">
                        <img alt="" src="http://www1.pcauto.com.cn/bbs/2013/cms/auto_index/loading.gif">加载中，请稍后
                    </span>
                </a>
            </div>
            <script type="text/javascript" src="http://js.3conline.com/wap/2013/common/js/zepto1.1.min.js"></script>
            <script>
                var pageNo = 1;
                var pageSize = 20;
                var clubId = '${requestScope.club.clubId}';
			
                function aFunc(data) {
                }
			
                function loadComment(){
                    //拼装页面
                    var commentHtml = '<li id="result">'
                        + '<a href="${BBSWAPROOT}/topic-{topicId}.html">'
                        + '<div class="tb">'
                        + '{iLable}'
                        + '<p class="s1">{topicTitle}</p>'
                        + '</div><div class="tf">'
                        + '<i class="name">{topicAuthor.nickname}</i>'
                        + '<i class="time">{createAt}</i>'    
                        + '<i class="reply-num">+{petrol}L</i>'
                        + '</div></a></li>';
		
                    var url = "${ROOT}/dyna/getDynaList.do?req_enc=utf-8&resp_enc=utf-8&clubId="+clubId
                        +"&type=1"
                        +"&pageNo=" + pageNo
                        +"&pageSize=" + pageSize
                        +"&_t="+new Date().getTime();
			
                    $.ajax({
                        type: 'POST',
                        url: url,
                        dataType: 'jsonp',
                        jsonpCallback:'aFunc',
                        success:function (data){
                            if (data.data && data.data.length > 0) {
                                $(".m-none").hide();
                                pageNo = data.pageNo+1;
                                var list = data.data;
                                $("#showMore").hide();
                                $("#loadMoreNow").show();
                                var resultHtml = "";
                                var pick = '';
                                var icon = '';
                                var iLabel;
                                for(var i = 0; i < list.length; i++){
                                    if(list[i].isRecommend){
                                        pick = "荐";
                                        icon = "iconC";
                                        iLabel = "<i class=" + icon +">" + pick + "</i>";
                                    }
                                    else if(list[i].isPick){
                                        pick = "精";
                                        icon = "iconB";
                                        iLabel = "<i class=" + icon +">" + pick + "</i>";
                                    }
                                    else if(!list[i].images || list[i].images.length==0){
                                        iLabel = '';
                                    }
                                    else{
                                        pick = '图';
                                        icon = "iconA";
                                        iLabel = "<i class=" + icon +">" + pick + "</i>";
                                    }
								
                                    resultHtml += commentHtml.replace(/{topicId}/ig,list[i].topicId)
                                    .replace(/{topicTitle}/ig,list[i].topicTitle)
                                    .replace(/{iLable}/ig,iLabel)
                                    .replace(/{topicAuthor.nickname}/ig,list[i].nickname)
                                    .replace(/{createAt}/ig, list[i].createAt)
                                    .replace(/{petrol}/ig,list[i].contribution);
                                }
                                $("#topic-list").append(resultHtml);
                                $("#loadMoreNow").hide();
                                $("#showMore").show(); 
							
                                if (list.length < pageSize || 
                                    Math.ceil(data.total*1.0/pageSize) == data.pageNo) {
                                    $(".btn-more").hide();
                                }
                            }else {
                                $(".m-none").show();
                                $(".btn-more").hide();
                            }
                            setHeight();
                        }
                    });	
                }
                $(function() {
                    // 帖子列表首屏
                    loadComment();
                });
			
                /*满屏功能*/
                function setHeight(){
                    var Jfoot = document.querySelector(".g-footer");
                    var Jbody = document.querySelector(".body");
                    if (!Jfoot) return;
                    if (!Jbody) return;
                    var webHeight = document.documentElement.clientHeight,
                    JbodyHeight = Jbody.clientHeight;
                    if (JbodyHeight < webHeight) {
                        Jbody.style.height = webHeight + "px";
                        Jbody.style.position = "relative";
                        Jfoot.setAttribute("style", "width:100%;position:absolute;bottom:0px;");
                    } else {
                        Jfoot.style.position = "relative";
                    }
                }
            </script>

            <div class="g-footer">
                <!-- 公共底部 -->
               <%@include file="../common/intf5987.html" %>
            </div>
        </div> 
    </body>
</html>